package com.lanyun.aicorrectassistant.basic.bean;

import lombok.Data;

/**
 * 分页请求实体
 *
 * @Author Jqcc
 * @Version 1.0
 * @Data 2024/2/14
 */
@Data
public class PageInfo {

    private Integer page = 1;

    private Integer pageSize = 20;

    public Integer getStart() {
        if (page == null || page < 1) {
            return 1;
        }
        return (page - 1) * getPageSize();
    }

    public Integer getPageSize() {
        if (pageSize == null || pageSize < 1 || pageSize > Integer.MAX_VALUE) {
            return 20;
        }
        return pageSize;
    }


    public Integer getPage() {
        return page;
    }

    public void setPage(Integer page) {
        this.page = page;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }
}
